get_characters

This function traps any characters that are sent to the game window.

string get_characters()

Parameters:
None.

Return value:
A string containing any printable characters that have been pressed inside the game window since the last call.

Remarks:
This function only traps printable characters such as letters, numbers, punctuation, symbols, etc. All other keys such as tab, control, escape and enter are ignored.

The function will return any characters pressed since the last call, up to 1KB, or 1024 characters. If the 1025th character is pressed, the first character is deleted and the whole queue of data is pushed to make room for the new entry.

Example:
// Give the user five seconds to do some typing and display the result.

timer wait_time;

void main()
{
alert("Waiting", "You have five seconds to type some text.");
show_game_window("Typing test");
while(true)
{
wait(5);
if(wait_time.elapsed>=5000)
{
wait_time.pause();
alert("Thanks", "Thanks for waiting for me. You typed "+get_characters()+". Goodbye.");
exit();
}
}
}